package com.cjm.one.system.client;

import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(value = ServerConstants.SERVER_ONE_SYSTEM)
public interface FileClient {
    @PostMapping(value = "/admin/system/file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @Operation(summary = "文件上传")
    public Result<String> uploadFile(
            @RequestPart("file") MultipartFile file,
            @RequestPart("category") String category
    );
    @GetMapping("/admin/system/file/download/{objectName}")
    @Operation(summary = "文件下载")
    public void downloadFile(@PathVariable String objectName,
                             HttpServletResponse response);
}
